package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;


import android.os.Bundle;

import com.example.myapplication.adapter.Myadapter;
import com.example.myapplication.fragment.Fragment1;
import com.example.myapplication.fragment.Fragment2;
import com.example.myapplication.fragment.Fragment3;

import java.util.ArrayList;


public class MainActivity extends AppCompatActivity {


    private ViewPager viewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
        initEvent();

    }

    private void initView() {
        viewPager = findViewById(R.id.viewpager);
        Fragment1 f1 = new Fragment1();
        Fragment2 f2 = new Fragment2();
        Fragment3 f3 = new Fragment3();

        ArrayList a = new ArrayList();
        a.add(f1);
        a.add(f2);
        a.add(f3);

        viewPager.setAdapter(new Myadapter(getSupportFragmentManager(),MainActivity.this,a));
    }

    private void initData() {

    }

    private void initEvent() {

    }
}

